<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <ol>
    <li id="first">张三</li>
    <li id="second"><span>李四</span></li>
    <li id="third">王五</li>
    <li>小明</li>
    <li>小红</li>
  </ol>
</body>

</html>
<script>
  var firstOne = document.getElementById('first')
  //通过innerHTML属性获取元素内容
  console.log(firstOne.innerHTML);
  var secondOne = document.getElementById('second');
  //通过innerHTML属性获取元素内容
  console.log(secondOne.innerHTML);
  var thirdOne = document.getElementById('third')
  //通过innerText属性设置元素内容
  thirdOne.innerText = '小兰';
</script>